<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jQuery.min.js"></script>
    <style>
        div {
            width: 150px;
            height: 150px;
            background-color: blue;
            margin: 100px auto;
            transition: all 0.5s;
        }

        .current {
            background-color: red;
            transform: rotate(360deg);
        }
    </style>
</head>

<body>
    <div class="current"></div>

    <script>
        $(() => {
            //当鼠标经过的时候
            $('div').mouseover(function () {
                //添加类
                // $(this).addClass('current')
                //删除类
                // $(this).removeClass('current')
                //切换类
                $(this).toggleClass('current')
            })
        })

    </script>

</body>

</html>